<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/commons/include.inc.jsp" %>
 <%--
	模块：${model.comment}
--%>
<div id="${ param.rel}_toolbar" class="search-div">
	<form  onsubmit="return datagridSearch(this,'${ param.rel}_datagrid');"> 
		<div  class="search-content " >
#foreach( $field in $fieldList )

#if("$field.inputValueOne" == "sy_users")	
			<span> 
			<label>${field.comment}：</label>
				<a href="user/lookUpPage.do?type=1"  lookupGroup="user" title="用户选择">
						<textarea  readonly="readonly"  toName="user.trueName"  rows="1" style="width: 100px"></textarea>
					</a>
					<input type="hidden"  name="${field.field}" toName="user.id" />
					<a class="easyui-linkbutton clearLookup"  icon="icon-cancel"	plain="true"  href="javascript:;"  clearLookup="user"  title="清空"></a>
					
				</span>	
#elseif("$field.inputValueOne" == "sy_dept")	
			<span> 
			<label>${field.comment}：</label>
			<a href="dept/lookUpPage.do?type=1" lookupGroup="dept" title="部门选择">
						<textarea  readonly="readonly"  toName="dept.deptName"  rows="1" style="width: 100px" ></textarea>
					</a>
					<input type="hidden" name="${field.field}" toName="dept.id" />
					<a class="easyui-linkbutton clearLookup"  icon="icon-cancel"	plain="true"  href="javascript:;"  clearLookup="dept"  title="清空"></a>

				</span>	
#elseif(${field.matchType}=="any"||${field.matchType}=="eq"||${field.matchType}=="left"||${field.matchType}=="right")			 
			<span>
				<label>${field.comment}：</label>
				<input type="text" name="${field.field}" id="${field.field}" placeholder="请输入${field.comment}"/>
				&nbsp;<i class="boot_icon-question-sign" selectLike="tooltip"></i>
			</span>
			
#elseif(${field.matchType}=="select")
#if("$!field.inputValueOne" == "")			 
			<span> 
			<label>${field.comment}：</label>
				<select class="combox"  id="${field.field}" name="${field.field}" >
                    <option value="">==请选择${field.comment}==</option>
        			<my:outOptions type="${field.inputValue}"/>
			   </select>
				</span>
#else	
			<span> 
			<label>${field.comment}：</label>
				<select class="combox"  id="${field.field}" name="${field.field}" >
                    <option value="">==请选择${field.comment}==</option>
        			<c:forEach items="${${field.inputValueOneL}EntityList}" var="item">
					<option value="${ item.code}">${  item.${field.inputValueTwo}}</option>
					</c:forEach>
			   </select>
				</span>		
#end
#elseif(${field.matchType}=="dateRange")
			<span>
				<label>发布时间：</label>
					<input type="text"  readonly="readonly" onFocus="WdatePicker()"  name="${field.field}Start" class="span2"/>
					--
					<input type="text"  readonly="readonly" onFocus="WdatePicker()" name="${field.field}End" class="span2"/>
			</span>
#end
#end	 
			</div>
			<div class="search-toolbar" >
			<span style="float:left;">
			<a class="easyui-linkbutton clearDgChecked"  icon="icon-redo"	plain="true"  title="清空所有勾选项" >清空勾选</a>
			<shiro:hasPermission name="${model.modelL}:add">  
					<a class="easyui-linkbutton"  icon="icon-add"	plain="true"
					  title="添加"   href="${model.modelL}/addPage.do.do?rel=${ param.rel}"  target="dialog" width="800" height="400" rel="${ param.rel}_add" >添加</a>
					
				</shiro:hasPermission>
				<shiro:hasPermission name="${model.modelL}:update">  
					<a class="easyui-linkbutton"  icon="icon-edit"	plain="true"
					  title="修改"	href="${model.modelL}/updatePage.do?id={id}&rel=${ param.rel}" target="navTab" width="800" height="400" rel="${ param.rel}_update" warn="请先选择一条记录" >修改</a>
					
				</shiro:hasPermission>
				<shiro:hasPermission name="${model.modelL}:delete">  
					<a class="easyui-linkbutton"  icon="icon-remove"	plain="true"
					   	 href="${model.modelL}/delete.do" target="selectedTodo"  title="请谨慎操作！确定要删除吗?" warn="至少选择一条记录">批量删除</a>
				</shiro:hasPermission>
				 
			<a  class="easyui-linkbutton"  icon="icon-search"	plain="true"	
						title="查看"	 href="${model.modelL}/show.do?id={id}" target="dialog" width="800" height="450" rel="${ param.rel}_updaterole" warn="请先选择一条记录">查看</a>
			</span>	
			<span style="float:right">
				<button class="btn btn-primary btn-small" type="submit">查询</button>&nbsp;
				<button class="btn btn-small clear" type="button" >清空</button>&nbsp;	
			</span>
		</div>
	</form>
</div>

<table id="${ param.rel}_datagrid"   toolbar="#${ param.rel}_toolbar"  title="${model.comment}"></table>


<script type="text/javascript" >
<!--	

	$(function() {
		
		$('#<%=request.getParameter("rel")%>_datagrid').datagrid({
			border:true,
			nowrap : false,
			url : "${model.modelL}/query.do",
			columns : [ [ 
				{
					field:"ck",
					title : "勾选",
					checkbox:true
				},
#foreach( $field in $fieldList )
#if($field.listShow == true&&${field.inputType}!="hidden")
#if(${field.inputType}!="datetime"&&${field.inputType}!="date"&&${field.inputType}!="time"
&&${field.columnName}!="create_time"&&${field.columnName}!="update_time")
            {
                width : 80,
                title : '${field.comment}',
                field : '${field.field}',
                align:"center",
            }, 
#elseif(${field.columnName}=="create_time"||${field.columnName}=="update_time")
            {
                width : 80,
                title : '${field.comment}',
                field : '${field.field}',
                align:"center",
                sortable : true,
					formatter: function(value,row,index){
						if(value!=null)
							return new Date(value).format("yyyy-MM-dd HH:mm:ss");
					}
            },
#elseif(${field.inputType}=="datetime"&&${field.columnName}!="create_time"&&${field.columnName}!="update_time")
            {
                width : 80,
                title : '${field.comment}',
                field : '${field.field}',
                align:"center",
                sortable : true,
					formatter: function(value,row,index){
						if(value!=null)
							return new Date(value).format("yyyy-MM-dd HH:mm:ss");
					}
            },
#elseif(${field.inputType}=="date")
            {
                width : 80,
                title : '${field.comment}',
                field : '${field.field}',
                align:"center",
                sortable : true,
					formatter: function(value,row,index){
						if(value!=null)
							return new Date(value).format("yyyy-MM-dd");
					}
            },
#end
#end
#end
				 {
					field : "action",
					title : "操作",
					align:"center",
					width : 120,
					formatter: function(value,row,index){
						
						return '<a href="${model.modelL}/show.do?id='+row.id+'&rel=<%=request.getParameter("rel")%>" target="dialog" width="800" height="450" rel="<%=request.getParameter("rel")%>_show" title="查看详情">详情</a>';
					}
				} 
			] ] ,
			onDblClickRow:function(rowIndex, rowData){
				MUI.openDialog('查看','${model.modelL}/show.do?id='+rowData.id+'&rel=<%=request.getParameter("rel")%>','<%=request.getParameter("rel")%>_update',{width:1000,height:450});
			}
		});
		
	});

//-->		
</script>
